#ifndef ROBOTS__HPP
#define ROBOTS__HPP

//#include "simulation_menu.hpp"
#include <algorithm>
#include <vector>
#include <list>

using namespace std;


vector<int> _robot_details;

//aruk osztalya
class Ware
{
private:
    int _day;
    string _type;
    int _quantity;

public:
    //konstruktor, destruktor
    Ware(int d, string t, int q) : _day(d), _type(t), _quantity(q) {}

    //getter
    int GetDay() const { return _day; }
    string GetType() const { return _type; }
    int GetQuantity() const { return _quantity; }

    //setter
    void ChangeQuantity(int q) { _quantity -= q; }
};


//robotok ososztalya
class Robot
{
protected:
    int _id;
    int _price;

public:
    //konstruktor, destruktor
    Robot(int id, int price) : _id(id), _price(price) {}
    virtual ~Robot() {}

    //getter
    int GetID() const { return _id; }
    int GetPrice() const { return _price; }
};

//forward declaration a hivatkozhatosag erdekeben
class DeliveryRobot;


//toltorobotok osztalya
class Charger : public Robot
{
private:
    bool _available;
    DeliveryRobot* _current;

public:
    //konstruktor, destruktor
    Charger() : Robot(_robot_details[0], _robot_details[1]), _available(true), _current(NULL) {}

    //getter
    bool IsAvailable() const { return _available; }

    //setter
    void ChangeState() { _available = (_available ? false : true); }
    void Connect(DeliveryRobot* p);

    //other
    void Charge();
};
typedef list<Charger*> chl;


//szallitorobotok osztalya
class DeliveryRobot : public Robot
{
private:
    int _capacity;
    int _performance;
    int _curr_charge_level;
    int _charge_price;
    int _charge_time;
    int _waiting;
    bool _active;

public:
    //konstruktor, destruktor
    DeliveryRobot(int i) : Robot(_robot_details[i], _robot_details[i+1]),
                           _capacity(_robot_details[i+2]), _performance(_robot_details[i+3]), _curr_charge_level(_robot_details[i+3]),
                           _charge_price(_robot_details[i+4]), _charge_time(_robot_details[i+5]), _waiting(0), _active(true) {}

    //getter
    int GetCapacity() const { return _capacity; }
    int GetPerformance() const { return _performance; }
    int GetCurrChargeLevel() const { return _curr_charge_level; }
    int GetChargePrice() const { return _charge_price; }
    int GetChargeTime() const { return _charge_time; }
    int GetWaiting() const { return _waiting; }
    bool IsActive() const { return _active; }

    //setter
    void ChangeState() { _active = (_active ? false : true); }
    void DecrWaiting() { --_waiting; }
    void SetCurrChargeLevel() { _curr_charge_level = _performance; }

    //other
    void Work(list<Ware*> & ware, int cap);
    void TryToConnect(list<Charger*> & chargers);
};
typedef list<DeliveryRobot*> dl;



#endif // ROBOTS__HPP
